#ifndef DAEMON_H_INCLUDED
#define DAEMON_H_INCLUDED

#include <string>
using namespace std;

namespace edm
{
    namespace common
    {
        class daemon_t
        {
        public:
                daemon_t(const char* root = "./",
                                                 const char* user = "nobody",
                                                 const char* group = "nobody");

                void signal_ignore(int sig);
                void daemonize();

        private:
                void fork(void);
                void setsid (void);
                void chroot (void);
                void close_fds (void);
                void set_user_and_group (void);

        private:
                daemon_t(const daemon_t& );
                daemon_t& operator=(const daemon_t& );

        private:
                string m_chroot_jail;
                string m_user;
                string m_group;
        };
    }
}


#endif
